package ckw.database;

import java.io.Serializable;

public class OKW_Election implements Serializable {

	private static final long serialVersionUID = -3966785404375645870L;

	private Long id;
	private Boolean isSend = false;
	private OKW okw;
	private Election election;
	private SummaryPackage summaryPackage = null;
	private int status = 0;
	
	public OKW_Election() {
	}

	public OKW_Election(OKW okw, Election election) {
		super();
		addToOkw(okw);
		addToElection(election);
	}

	public Long getId() {
		return id;
	}

	@SuppressWarnings("unused")
	private void setId(Long id) {
		this.id = id;
	}

	public Boolean getIsSend() {
		return isSend;
	}

	public void setIsSend(Boolean isSend) {
		this.isSend = isSend;
	}

	public OKW getOkw() {
		return okw;
	}

	public void setOkw(OKW okw) {
		this.okw = okw;
	}

	public void addToOkw(OKW okw) {
		this.setOkw(okw);
		okw.getOkw_elections().add(this);
	}

	public void removeFromOkw(OKW okw) {
		this.setOkw(null);
		okw.getOkw_elections().remove(this);
	}

	public Election getElection() {
		return election;
	}

	public void setElection(Election election) {
		this.election = election;
	}

	public void addToElection(Election election) {
		this.setElection(election);
		election.getOkw_elections().add(this);
	}

	public void removeFromElection(Election election) {
		this.setElection(null);
		election.getOkw_elections().remove(this);
	}

	public SummaryPackage getSummaryPackage() {
		return summaryPackage;
	}

	public void setSummaryPackage(SummaryPackage summaryPackage) {
		this.summaryPackage = summaryPackage;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getStatusString(){
		switch(getStatus()) {
		case 0:
			return "nierozpoczęte";
		case 1:
			return "w trakcie";
		case 2:
			return "zakończone";
		default:
				return null;
		}		
	}
}
